/*
 * macros.h
 *
 * Usable global macros and inline functions
 *
 * Authors: 107 <107@mail.ru>
 */

// TODO: Set my app version here
#define VERSION L"0.1.1"


#ifndef MACROS_H_
#define MACROS_H_

#include <FBase.h>
#include <FApp.h>

#define TEST_R(r) if (IsFailed(r)) SetLastResult(r)
#define IF_WARNING(text) if (IsFailed(GetLastResult())) msg( "WARNING", text )
#define IF_ERROR_RETURN(text) if (IsFailed(GetLastResult())) { msg( "ERROR", text ); return; }

// localization
inline Osp::Base::String S( Osp::Base::String id ) {
		Osp::Base::String tmp;
		result r = Osp::App::Application::GetInstance()->GetAppResource()->GetString( id , tmp );
		if (IsFailed(r)) tmp=id;
		return tmp;
};

#endif /* MACROS_H_ */
